package com.orangelife.service.propApp.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;

import com.orangelife.common.MybaitsGenericDaoSubLogic;
import com.orangelife.service.propApp.IPropFeeMemberApartmentService;
import com.orangelife.service.propApp.model.PropFeeMemberApartment;

@Service("propFeeMemberApartmentService")
public class PropFeeMemberApartmentServiceImpl extends
		MybaitsGenericDaoSubLogic implements IPropFeeMemberApartmentService {

	@Override
	public List<PropFeeMemberApartment> selectByPrimaryKey(String id) {
		Map<String, Object> map = new HashMap<String, Object>();

		map.put("id", id);

		return this.getSqlSession().selectList(
				"PropFeeMemberApartmentMapper.selectByPrimaryKey", map);
	}

	@Override
	public void insertSelectiveByList(List<PropFeeMemberApartment> list) {
		SqlSession sqlSession = this.getSqlSession();

		for (PropFeeMemberApartment propFeeMemberApartment : list) {
			sqlSession.insert("PropFeeMemberApartmentMapper.insertSelective",
					propFeeMemberApartment);
		}

	}

	@Override
	public void updateByPrimaryKeySelective(
			PropFeeMemberApartment propFeeMemberApartment) {
		this.getSqlSession().update(
				"PropFeeMemberApartmentMapper.updateByPrimaryKeySelective",
				propFeeMemberApartment);

	}

	@Override
	public void deleteinfo(PropFeeMemberApartment propFeeMemberApartment) {

		propFeeMemberApartment.setItemStat("0");

		this.getSqlSession().update(
				"PropFeeMemberApartmentMapper.updateByPrimaryKeySelective",
				propFeeMemberApartment);

	}

	@Override
	public List<PropFeeMemberApartment> selectList(String apartmentID,
			String commID, String userId) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("memberId", userId);
		map.put("commId", commID);
		map.put("apartmentId", apartmentID);
		return this.getSqlSession().selectList(
				"PropFeeMemberApartmentMapper.selectMemberAparment", map);
	}


}
